package feevale.boteco.view.table;

import java.util.ArrayList;
import java.util.List;

import javax.swing.table.AbstractTableModel;

import feevale.boteco.bean.Cliente;

public class ClienteTableModel extends AbstractTableModel {

	private List<Cliente> rows;
    private String[] columns = new String[] {"Balcão"};
   
    public ClienteTableModel() {
    	rows = new ArrayList<Cliente>();
    }
   
    public ClienteTableModel(List<Cliente> clientes) {
    	rows = clientes;
    }
   
    @Override
    public int getRowCount() {
    	return rows.size();
    }

    @Override
    public int getColumnCount() {
    	return columns.length;
    }
   
    @Override
    public String getColumnName(int columnIndex) {
    	return columns[columnIndex];
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
    	Cliente cliente = rows.get(rowIndex);
        
        switch (columnIndex) {
        	case 0 : return cliente != null ? cliente.getNome() : "";
        }
        
        return null;
    }

	
}
